import request from '@/utils/request'
import { resolve } from 'core-js/fn/promise'

export function fetchList2(query) {
  return request({
    url: 'http://api.hometasty.info/shop2/admin/user/list',
    method: 'get',
    params: query
  })
}

export function updateInviteCode(query) {
  return request({
    url: 'http://www.hometasty.info/demo/user.php',
    method: 'get',
    params: query
  })
}
export function getAllMonth(query) {
  return new Promise((resolve,reject)=>{
    resolve(request({
      url: 'http://www.hometasty.info/demo/oderkj.php',
      method: 'get',
      params: query
    }))
  })
}
export function getAllTotal(query) {
  return new Promise((resolve,reject)=>{
    resolve(request({
      url: 'http://www.hometasty.info/demo/oderlj.php',
      method: 'get',
      params: query
    }))
  })
}

export function getAllLast(query) {
    return new Promise((resolve,reject)=>{
      resolve(request({
        url: 'http://www.hometasty.info/demo/odersy.php',
        method: 'get',
        params: query
      }))
    })
  }

export function findZzjg(query) {
    return new Promise((resolve,reject)=>{
        resolve(request({
            url: 'http://api.hometasty.info/shop2/admin/user/findZzjg',
            method: 'post',
            params: query
        }))
    })
}
export function fetchList(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}


export function findVip() {
  return request({
    url: '/user/findVip',
    method: 'get'
  })
}
// 获取地址列表
export function levelList(data) {
  return request({
    url: 'http://api.hometasty.info/shop2/wx/pv/findZzjg',
    method: 'get',
    params: data
  })
}
export function userDetail(id) {
  return request({
    url: '/user/detail',
    method: 'get',
    params: { id }
  })
}
export function userDetail2(id) {
   return new Promise((resolve,reject)=>{
      resolve(request({
        url: '/user/detail',
        method: 'get',
        params: { id }
      }))
   })
}
export function addUser(data) {
  return request({
    url: 'http://api.hometasty.info/shop2/admin/user/addUser',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/user/update',
    method: 'post',
    data
  })
}

export function getUserAddress(userId) {
  return request({
    url: '/user/getUserAddress',
    method: 'get',
    params: { userId }
  })
}

export function getUserCollection(userId) {
  return request({
    url: '/user/getUserCollection',
    method: 'get',
    params: { userId }
  })
}

export function listAddress(query) {
  return request({
    url: '/address/list',
    method: 'get',
    params: query
  })
}

export function listCollect(query) {
  return request({
    url: '/collect/list',
    method: 'get',
    params: query
  })
}

export function listFeedback(query) {
  return request({
    url: '/feedback/list',
    method: 'get',
    params: query
  })
}

export function listFootprint(query) {
  return request({
    url: '/footprint/list',
    method: 'get',
    params: query
  })
}

export function listHistory(query) {
  return request({
    url: '/history/list',
    method: 'get',
    params: query
  })
}

export function userlistDao(query) {
  return request({
    url: '/user/excel',
    method: 'get',
    params: query
  })
}

